import { http } from "@/utils/http";

export type UnpaidBillItem = {
  id: number;
  cellName: string;
  payer: string;
  payerType: number;
  phone: string;
  email: string;
  chargestandardName: string;
  price: number;
  receivableAmount: number;
  overdueAmount: number | null;
  totalAmount: number;
  notification: number | null;
  remark: string;
};

export type UnpaidBillListParams = {
  page: number;
  limit: number;
  name: string;
  notification?: number; // 0:全部 1:已通知 2:未通知
};

export type UnpaidBillListResult = {
  code: number;
  data: UnpaidBillItem[];
  message: string;
};

export type SendNotificationResult = {
  code: number;
  message: string;
};

// 获取未缴账单列表
export const getUnpaidBillList = (params: UnpaidBillListParams) => {
  return http.request<UnpaidBillListResult>("post", "/SpBill/statusList0", {
    data: params
  });
};

// 发送通知
export const sendNotification = (ids: number[]) => {
  return http.request<SendNotificationResult>(
    "post",
    "/SpBill/sendNotification",
    {
      data: { ids }
    }
  );
};
